package cn.iocoder.yudao.module.blog.dal.mysql.improvesection;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.dal.dataobject.improvesection.BlogImproveSectionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.improvesection.vo.*;

/**
 * 课程章节 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogImproveSectionMapper extends BaseMapperX<BlogImproveSectionDO> {

    default PageResult<BlogImproveSectionDO> selectPage(BlogImproveSectionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogImproveSectionDO>()
                .eqIfPresent(BlogImproveSectionDO::getImproveId, reqVO.getImproveId())
                .likeIfPresent(BlogImproveSectionDO::getName, reqVO.getName())
                .betweenIfPresent(BlogImproveSectionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogImproveSectionDO::getId));
    }

    default List<BlogImproveSectionDO> selectList(BlogImproveSectionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogImproveSectionDO>()
                .eqIfPresent(BlogImproveSectionDO::getImproveId, reqVO.getImproveId())
                .likeIfPresent(BlogImproveSectionDO::getName, reqVO.getName())
                .betweenIfPresent(BlogImproveSectionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogImproveSectionDO::getId));
    }

}
